package com.changwu.cwbase.ui.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.changwu.cwbase.R;
import com.changwu.cwbase.base.FragmentBase;
import com.changwu.cwbase.ui.activity.main.RecyclerCardViewActivity;
import com.changwu.cwbase.util.AppViewUtil;
import com.changwu.cwbase.util.IntentUtil;

import butterknife.BindView;
import butterknife.OnClick;


/**
 * Created by changuw on 2018/2/12.
 */

public class UserCenterFragment extends FragmentBase {
    @BindView(R.id.content)
    TextView content;
    static final String text = "<h1>Test</h1><div class=\"topic_content\" itemprop=\"articleBody\">" +
            "<img alt=\"\" src=\"http://img10.360buyimg.com/imgzone/jfs/t2719/53/693438809/405912/957c1efa/5721e109N8ad86029.jpg\">" +
            "<img alt=\"\" src=\"http://img10.360buyimg.com/imgzone/jfs/t2836/30/707249522/270588/840d428a/5721e108Ne667230f.jpg\">" +
            "<img alt=\"\" src=\"http://img10.360buyimg.com/imgzone/jfs/t2305/211/1222246162/89571/4ce4f9a1/56496ac7N982aa001.jpg\">" +
            "<img alt=\"\" src=\"http://img10.360buyimg.com/imgzone/jfs/t2695/76/715579111/331050/cf2ae9f9/5721e10aNd690b026.jpg\">" +
            "<img alt=\"\" src=\"http://img10.360buyimg.com/imgzone/jfs/t2341/288/2958575364/740490/9678e90f/5721e10bNf923ebaa.jpg\">" +
            "<img alt=\"\" src=\"http://img10.360buyimg.com/imgzone/jfs/t2776/164/715581717/852142/2fa4714f/5721e10bN04e38f08.jpg\">" +
            "<img alt=\"\" src=\"http://img10.360buyimg.com/imgzone/jfs/t2104/197/2936780208/316761/f3051b63/5721e10cN1b74089c.jpg\">" +
            "<br>" +
            "</div>";

    public static Fragment newInstance() {
        UserCenterFragment fragment = new UserCenterFragment();
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        // reqMerchant("", 1);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fm_user_center, container, false);
        return view;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initData();
        showText();
    }

    private void showText() {
        AppViewUtil.showHtml(content, text);
    }

    private void initData() {
    }

    @OnClick({R.id.go})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.go:
                IntentUtil.startActivity(activity, RecyclerCardViewActivity.class);
                break;
        }
    }
}
